package com.novel.authorization.constant;

import lombok.Getter;

/**
 * UserStatusEnum
 * 用户状态枚举
 *
 * @author 樊温军
 * @date 2025/3/25 下午1:59
 */
@Getter
public enum UserStatusEnum {
    NON_AUTH("NON_AUTH", "注册未认证"),
    NORMAL("NORMAL", "正常"),
    LOCKED("LOCKED", "锁定"),
    LOGOUT("LOGOUT", "注销");

    private final String code;
    private final String name;

    UserStatusEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public static UserStatusEnum getByCode(String code) {
        for (UserStatusEnum userStatusEnum : UserStatusEnum.values()) {
            if (userStatusEnum.getCode().equals(code)) {
                return userStatusEnum;
            }
        }
        return null;
    }
}
